import request from '@/utils/request'
import type {attrValueModel}  from './model/attrModel'
import type {categoryIdsModel} from './model/categoryModel'
// get /admin/product/attrInfoList/{category1Id}/{category2Id}/{category3Id}
enum Api {
  // 获取属性数据列表
  getAttrValueList='/admin/product/attrInfoList',
  // 删除属性 delete /admin/product/deleteAttr/{attrId}
  deleteAttrValue = '/admin/product/deleteAttr',
    // 添加属性
  // /admin/product/saveAttrInfo
  saveAttrInfo = '/admin/product/saveAttrInfo'
}
// 通过三级接口获取属性数据列表
export const reqGetAttrValueList = ({category1Id,category2Id,category3Id}:categoryIdsModel) => {
  return request.get<any,attrValueModel>(`${Api.getAttrValueList}/${category1Id}/${category2Id}/${category3Id}`)
}
// 删除属性
export const reqDelOneAttrValue = (attrId:number) => {
  return request.delete(Api.deleteAttrValue + `/${attrId}`)
}
// 添加属性
export const reqPostSaveOrUpdateAttrInfo = (attrInfo:any) => {
  return request.post<any,any>(Api.saveAttrInfo,attrInfo)
}

